package com.ym.b2b.charge.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.ym.b2b.charge.dao.SaleSummaryDao;
import com.ym.b2b.charge.service.SaleSummaryService;
import com.ym.b2b.charge.vo.SaleSummaryVO;
import com.ym.b2b.commons.exception.BaseException;
import com.ym.b2b.commons.service.BaseService;
import com.ym.b2b.commons.util.CheckData;
import com.zc.commons.base.Page;
import com.zc.commons.base.Result;

/**
 * @ClassName: SaleSummaryServieImpl
 * @Description: TODO
 * @Author tangxj
 * @Date 2015-3-10 下午3:23:59
 * @Modify
 * @CopyRight B2B小组
 */

@Service
public class SaleSummaryServieImpl extends BaseService implements SaleSummaryService {

    @Autowired
    private SaleSummaryDao saleSummaryDao;

    @Override
    public Result searchPageSaleSummary(SaleSummaryVO saleSummaryVO, Page<SaleSummaryVO> page) throws BaseException {
        Result result = new Result();
        try {
            String areaCode = saleSummaryVO.getAreaCode();
            if (areaCode != null && !"".equals(areaCode)) {
                CheckData cd = new CheckData();
                areaCode = cd.checkSearchAreaCode(areaCode);
                saleSummaryVO.setAreaCode(areaCode);
            }
            result.setResultPage(saleSummaryDao.searchPageSaleSummary(saleSummaryVO, page));
        } catch (Exception e) {
            e.printStackTrace();
            throw new BaseException("订单查询异常");
        }
        return result;
    }

}
